/*
* 订单列表
* */

/*
获取所有的订单信息
 */
//统一调用
getOrderList();
function getOrderList() {
    console.log("getOrderList~~~")
    $.ajax({
        url:'/api/recovery/getList',
        type:'get',
        data:{},
        dataType:'json',
        success:function (data) {
            console.log(data)
            var html = "";
            $.each(data,function (index,item) {

                //遍历当前订单的详情，统计总金额
                var sum = 0;
                $.each(item.orderDetails,function (i,detail) {
                    sum += detail.resultPrice * detail.count
                });

                html += '<div class="order-box '+(item.status < 4 ? 'order-pay':'')+'">\n' +
                    '\t\t\t\t\t\t\t<div class="order-header">\n' +
                    '\t\t\t\t\t\t\t\t<div class="status '+(item.status < 4 ? 'status-pay':'')+' ">\n' +
                    ['等待审核','审核成功，请保持电话畅通'][item.status] +
                    '\t\t\t\t\t\t\t\t</div>\n' +
                    '\t\t\t\t\t\t\t</div>\n' +
                    '\n' +
                    '\t\t\t\t\t\t\t<table class="detail">\n' +
                    '\t\t\t\t\t\t\t\t<thead>\n' +
                    '\t\t\t\t\t\t\t\t\t<tr>\n' +
                    '\t\t\t\t\t\t\t\t\t\t<th class="info">书名：'+item.bookName+' 作者：'+item.author+' +  '+item.time+' | 学院: '+item.collegeE.name+' |专业: '+item.majorE.name+' </th>\n' +
                    '\t\t\t\t\t\t\t\t\t</tr>\n' +
                    '\t\t\t\t\t\t\t\t</thead>\n'+
                    '\t\t\t\t\t\t\t\t</table>\n';

                  html +=  '\t\t\t\t\t\t</div>';
            });
            $(".order-list").html(html);
        },
        error:function () {

        }
    });
}